package com.baizhi.controller.product;

import com.baizhi.entity.PmsAttrGroup;
import com.baizhi.service.IPmsAttrGroupService;
import com.baizhi.vo.PmsAttrGroupVo;
import com.baizhi.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("attr-group")
public class PmsAttrGroupController {
    @Autowired
    private IPmsAttrGroupService attrGroupService;

    @GetMapping("selectAttrGroupBySizeAndCateId")
    public R selectAttrGroupBySizeAndCateId(Integer page,Integer limit,Long categoryId){
        return attrGroupService.selectAttrGroupBySizeAndCateId(page,limit,categoryId);
    }

    @PostMapping("addAttrGroup")
    public R addAttrGroup(PmsAttrGroupVo vo){
        /**
         * 事务 一组数据库能够改变数据库信息的操作 保证同时成功或者同时失败
         */
        attrGroupService.addAttrGroup(vo);
        return R.ok();
    }
}
